<?php
     if(isset($_GET['secao'])){
                    session_start();
                    if(strcmp(session_id(),$_GET['secao'])==1){
                        header('Location: Login.php');
                    }
    echo "<html>";
        echo    "<head>";
           echo "<title></title>";
            echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
            echo "<Link rel=\"stylesheet\" href=\"Forms.css\" type=\"text/css\"/>";
        echo "</head>";

                    if(isset ($_GET['act']) && strcasecmp($_GET['act'],"alt")==0){
                        include_once 'Conexao.php';
                        $bd = new Conexao();
                        $bd->conectar();
                        $chave = $_GET['id'];
                        $obj=$bd->selectPlantao($chave,2);
                        $info = mysql_fetch_array($obj);
                        $act = "altHorario";
                   }else
                       $act = "cadHorario";
                 

       echo "<body>";
            echo "<form method=\"POST\" action=\"Inserts.php?act=$act&id="; if(isset($_GET['id'])){ echo $_GET['id'];}else echo null; echo "\"  enctype=\"multipart/form-data\"\">";
                echo "<table><caption>Dados do Horário</caption>";
                    echo "<tr/>";
                        echo "<td/>*Dia da semana:";
                        echo "<td/><input type=\"text\" name=\"dia\" value=\""; if(isset($info['dia']))echo $info['dia']; echo "\">";
                    echo "<tr/>";
                        echo "<td/>*Início do expediente:";
                        echo "<td/><input type=\"text\" name=\"inicio\" value="; if(isset($info['horarioInicio']))echo $info['horarioInicio'];echo ">";
                    echo "<tr/>";
                       echo "<td/>*Fim do expediente:";
                        echo "<td/><input type =\"text\" name=\"fim\" value="; if(isset($info['horarioFim']))echo $info['horarioFim']; echo ">";
                    echo "<tr/>";
                        echo "<td/>*Farmaceutico responsável:";
                        echo "<td/><input type =\"text\" name=\"farmaceutico\" value=\""; if(isset($info['farmaceutico']))echo $info['farmaceutico']; echo "\">";
                    echo "<tr/>";
                        echo "<td/>*Telefone:";
                        echo "<td/><input type =\"text\" name=\"tel\" value="; if(isset($info['telefone']))echo $info['telefone']; echo">";
                    echo "<tr/>";
                        echo "<td/>*Celular:";
                        echo "<td/><input type =\"text\" name=\"cel\" value="; if(isset($info['celular']))echo $info['celular']; echo ">";
                    echo "<tr/>";
                        echo "<td/>*Endereço:";
                        echo "<td/><input type =\"text\" name=\"endereco\" value=\""; if(isset($info['endereco']))echo $info['endereco']; echo "\">";
                        echo "<tr/>";
                        echo "<td align=\"right\">";
                        echo "<input type=\"submit\" name=\"enviar\" value=\"Confirmar\">";
                        echo "<td/>";
                        echo "<input type=\"reset\" name=\"limpar\" value=\"Limpar\">";
                echo "</table>";
            echo "</form>";

        echo "</body>";
    echo "</html>";
}else{
       header('Location: Login.php');
 }
 ?>